<div class="toolbar">
	<div class="pager">
		<p class="amount">
			Có <?php echo $pages->getItemCount(); ?> sản phẩm.
		</p>
		<div class="limiter">
			<label>
				Hiển thị
			</label>
            <?php 
                $params=$_SERVER['REQUEST_URI']; 
                $params=str_replace( '&limit=6', '',$params); 
                $params=str_replace( '&limit=12', '',$params);
                $params=str_replace( '&limit=18', '',$params);
                $params=str_replace( '&limit=24', '',$params); 
            ?>
			<select onchange="setLocation(this.value)">
				<option value="<?php echo $params; ?>&limit=6">
					6
				</option>
				<option value="<?php echo $params; ?>&limit=12" selected="selected">
					12
				</option>
				<option value="<?php echo $params; ?>&limit=18">
					18
				</option>
				<option value="<?php echo $params; ?>&limit=24">
					24
				</option>
			</select>
		</div>
		<?php 
        	if($pages->getPageCount()>1){ 
        ?>
		<div class="pages">
            <?php
                $this->widget('CLinkPager',array(
                    'pages'=>$pages,
                    'currentPage'=>$pages->getCurrentPage(),
                    'nextPageLabel'=>'Tiến',
                    'prevPageLabel'=>'Lùi',
                    'firstPageLabel'=>'Trang đầu',
                    'lastPageLabel'=>'Trang cuối',
                    'header'=>'',
                    'selectedPageCssClass'=>'current',
                    'nextPageCssClass'=>'page',
                    'previousPageCssClass'=>'page',
                    'maxButtonCount'=>6,
                    'selectedPageCssClass'=>'selected',
                ));	
            ?>
		</div>
        <?php 
        	} 
        ?>
	</div>
	<div class="sorter">
		<?php
            if(isset($_GET['mode'])&&$_GET['mode']=='list'){  	
        ?>
        <p class="view-mode">
			<label>
				Kiểu:
			</label>
			<?php 
                echo CHtml::link( 'Grid',array( 'Browser/ViewBy', 'mode'=>'grid'),array('class'=>'grid','title'=>'grid')); 
            ?>
            <strong title="List" class="list">
					Danh sách
			</strong>
				&nbsp;
		</p>
        <?php
        	}else{
        ?>
        <p class="view-mode">
            <label>View as:</label>
            <strong title="Grid" class="grid">Lưới</strong>&nbsp;
            <?php
            	echo CHtml::link('List',array( 'Browser/ViewBy', 'mode'=>'list'),array('class'=>'list','title'=>'list')); 
            ?>&nbsp;
        </p>
        <?php
        	}
        ?>
		<div class="sort-by">
			<?php 
                $params=$_SERVER['REQUEST_URI']; 
                $params=str_replace( '&dir=desc', '',$params); 
                $params=str_replace( '&dir=asc', '',$params); 
            ?>
            <div class="right">
				<?php
                    if(isset($_GET['dir'])&&$_GET['dir']=='asc'){
                ?>
                <a class="fa fa-arrow-down" href="<?php echo $params; ?>&dir=desc" title="Giảm"></a>
                <?php
                	}else{
                ?>
                <a class="fa fa-arrow-up" href="<?php echo $params; ?>&dir=asc" title="Tăng"></a>
                <?php
                	}
                ?>
			</div>
			<label>
				Sắp xếp theo
			</label>
			<?php 
                $params=$_SERVER['REQUEST_URI']; 
                $params=str_replace( '&order=price', '',$params); 
                $params=str_replace( '&order=name', '',$params); 
            ?>
				<select onchange="setLocation(this.value)">
					<option value="#">
						-- Sắp xếp --
					</option>
					<option value="<?php echo $params; ?>&order=name" <?php if(isset($_GET['order'])&&$_GET['order']=='name'){echo 'selected="selected"';} ?>>
						Tên
					</option>
					<option value="<?php echo $params; ?>&order=price" <?php if(isset($_GET['order'])&&$_GET['order']=='price'){echo 'selected="selected"';} ?>>
						Giá
					</option>
				</select>
		</div>
	</div>
</div>